from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from applications.extensions import db


class PoliceModels(db.Model):
    __tablename__ = 't_police'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='序号')
    code = db.Column(db.String(255), comment='用户id')
    name = db.Column(db.String(255), comment='警员姓名')
    sex = db.Column(db.String(2), comment='性别')
    birthday = db.Column(db.String(16), comment='出生年月')
    id_number = db.Column(db.String(255), comment='身份证号')
    native_place = db.Column(db.String(255), comment='籍贯')
    address = db.Column(db.String(255), comment='住址')
    post = db.Column(db.String(255), comment='职位')
    title = db.Column(db.String(255), comment='警衔')
    dept_id = db.Column(db.Integer, comment='部门id')
    uwb_sn = db.Column(db.String(32), comment="UWB设备SN")
    gps_sn = db.Column(db.String(32), comment="GPS设备SN")
    sign_sn = db.Column(db.String(32), comment="体征设备SN")
    title_id = db.Column(db.Integer, comment='警衔id')
    post_id = db.Column(db.Integer, comment='职位id')


class PoliceDetail(db.Model):
    __tablename__ = 'police_records'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='训练记录编号')
    police_id = db.Column(db.Integer,  comment='警员编号')
    class_id = db.Column(db.Integer, comment='课程编号')
    score = db.Column(db.Integer, comment='评分')
    update_time = db.Column(db.DateTime, comment='时间')
